Arithmetic Operators
Arithmetic operators perform such familiar mathematical operations as addition or multiplication on the specified operands. Arithmetic operators are restricted to working on numeric VectorScript data types. The table below summarizes the arithmetic operators available in VectorScript.
 
Unary negation ( - )
When - is used as a unary operator preceding a single operand, it performs a negation operation on the operand. That is, it converts a positive value to an equivalently negative value, or it converts a negative value to its equivalently positive value.
Addition ( + )
The + operator adds two numeric operands. This operator is limited to addition only; unlike in many other languages, this operator may NOT be used to concatenate strings.
Subtraction ( - )
The - operator subtracts the second operand from the first. Both operands must be numeric.
Multiplication ( * )
The * operator multiplies its two numeric operands.
Division ( / )
The / operator divides the first operand by its second operand. The operator performs floating-point division, always returning a value of type REAL even when both operands are of INTEGER or LONGINT type.
Integer Division ( DIV )
The DIV operator divides the first operand by its second operand, always returning a result of type INTEGER or LONGINT. The value of i DIV j is the mathematical quotient of i/j, rounded down to the nearest INTEGER or LONGINT value. For example, the operation
j:= 36 DIV 5;
will return a result of 7, which is assigned to the variable j.
Remainder Division ( MOD )
The MOD operator divides the first operand by the second and returns the remainder of the operation as a result of type INTEGER. For example, the operation
k:= 36 MOD 5;
will return a value of 1, which is assigned to k.
Exponentiation ( ^ )
The ^ operator raises the first operand to the power indicated by the second operand; that is, x^y is equivalent to x to the yth power.

Expressions : Arithmetic Operators

Nemetschek NA
Phone: 410.290.5114
Fax: 410.290.8050